#pragma once
#include <event2/util.h>
#include "XCom.h"
struct event_base;
class XCOM_API XTask
{
public:
    // 任务的初始化函数
    virtual bool Init() = 0;
    virtual ~XTask() {}
    inline evutil_socket_t sock(){
        return m_sock;
    }
    inline void setSock(evutil_socket_t sock){
        this->m_sock = sock;
    }
    inline event_base *base(){
        return m_base;
    }
    inline void setBase(event_base *base){
        this->m_base = base;
    }
    inline int getThreadId(){
        return threadId;
    }
    inline void setThreadId(int id){
        threadId = id;
    }

private:
    evutil_socket_t m_sock = -1;
    event_base *m_base = nullptr;
    int threadId = 0;
    // friend class XThread;
    // friend class XThreadPool;
};